问题

上传图片时报错:
Content type ‘multipart/form-data;boundary=—-WebKitFormBoundarypOpfYxCGU6Q4sciA;charset=UTF-8’ not supported

在这里插入图片描述
Controller层:

@PostMapping(path = "/uploadRotationImg")
public ResponseEntity<String> uploadRotationImg(@RequestParam("photos") MultipartFile file, @RequestBody ImgRotation imgRotation) {
    try {
        // 进行上传操作
        return imgRotationService.uploadRotationImg(file, imgRotation);
    } catch (Exception e) {
        // 上传失败
        e.printStackTrace();
        return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

解决

去掉@RequestBody注解就行了

@PostMapping(path = "/uploadRotationImg")
public ResponseEntity<String> uploadRotationImg(@RequestParam("photos") MultipartFile file, ImgRotation imgRotation) {
    try {
        // 进行上传操作
        return imgRotationService.uploadRotationImg(file, imgRotation);
    } catch (Exception e) {
        // 上传失败
        e.printStackTrace();
        return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

YOLO